package org.alfalfa.datacenter;

import org.alfalfa.component.APInstance;
import org.alfalfa.model.Action;

import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author : Max-Goday
 * @Created : 2016-10-21
 * @E-mail : goday.max@gmail.com
 * @Version : 1.0
 */
public class ThreadPoolCenter {

	public static final String ACCOUNT_SCOPE = "ACCOUNT_";
	public static final String USER_SCOPE = "USER_";

	//key like  user + farmid
	private static ConcurrentHashMap<String, APInstance> TMAP = new ConcurrentHashMap();

	private static ConcurrentHashMap<String, Action> ACTIONMAP = new ConcurrentHashMap();


	public static void putApThread(String key, APInstance ap) {
		TMAP.put(key, ap);
	}

	public static APInstance getApByKey(String key) {
		return TMAP.get(key);
	}


	public static Enumeration<String> getTmapKeySet() {
		return TMAP.keys();
	}

}
